//==================================================================
//  Copyright (C) 2006  Davide Pasca
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//==================================================================
///
///
///
///
///
//==================================================================

#ifndef RENDM5D_PARAMS_H
#define RENDM5D_PARAMS_H

#include "psys.h"
#include "m5d_mesh.h"

//==================================================================
namespace RendM5D {

//==================================================================
///
//==================================================================
enum {
	RENDTYPE_STANDARD,
	RENDTYPE_VERT_NORMALS,
	RENDTYPE_TRI_ID,
	RENDTYPE_TRI_ONOFFCOL,
	RENDTYPE_MODEL_ID,
	RENDTYPE_PLAIN,
	RENDTYPE_BBOX
};

//==================================================================
struct Params
{
	u_int			render_type;
	
	u_int			tri_onoff_idxbase;
	const u_char	*tri_onoffmap;
	float			tri_onoff_oncol[4];
	float			tri_onoff_offcol[4];

	BitMap			model_vismap;
	bool			use_lights;

	const M5D::Mesh	*onface_meshp;
	int				oneface_tri_idx;

	u_int			cur_rend_id;

private:
	u_char			_tmp_vismap_buffer[8192/8];
	BitMap			_tmp_vismap;
	bool			_is_prepared;

	RendShader::Param	_proj_obj_m_shparam;
	RendShader::Param	_view_obj_m_shparam;

	M5D::Camera			*_secondary_camp;
	RendShader::Param	_secondary_cam_lproj_obj_m_shparam;

public:
	Params() :
		render_type(RENDTYPE_STANDARD),
		tri_onoffmap(NULL),
		use_lights(true),
		onface_meshp(NULL),
		oneface_tri_idx(0),
		cur_rend_id(0),
		tri_onoff_idxbase(0),
		_is_prepared(false),
		_proj_obj_m_shparam(0),
		_view_obj_m_shparam(0),
		_secondary_camp(NULL),
		_secondary_cam_lproj_obj_m_shparam(0)
	{
	}

	void SetPlain( RendShader::Param proj_obj_m_shparam,
				   RendShader::Param view_obj_m_shparam,
				   M5D::Camera *secondary_camp,
				   RendShader::Param secondary_cam_lproj_obj_m_shparam )
	{
		render_type = RENDTYPE_PLAIN;
		_proj_obj_m_shparam = proj_obj_m_shparam;
		_view_obj_m_shparam = view_obj_m_shparam;
		_secondary_camp = secondary_camp;
		_secondary_cam_lproj_obj_m_shparam = secondary_cam_lproj_obj_m_shparam;
	}

	friend class Scene;
};

};

#endif
